package cn.tedu.csmall.product.controller;

import cn.tedu.csmall.product.pojo.dto.SpuAddNewDTO;
import cn.tedu.csmall.product.service.ISpuService;
import cn.tedu.csmall.product.web.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@Api(tags = "spu的控制器")
@RequestMapping("/spu")
public class spuController {

    @Autowired
    private ISpuService service;

    @ApiOperation("添加spu")
    @PostMapping("/addNew")
    public JsonResult<Void> addNew(SpuAddNewDTO addNewDTO){
        log.debug("开始处理【新增SPU】的业务，参数：{}", addNewDTO);
        service.addNew(addNewDTO);
        return JsonResult.ok();
    }
}
